package com.geekydoo.commands;

import generated.TaskType;

import java.util.List;

import com.geekydoo.GeekyDooException;

/**
 * The purpose of this interface is to define the contract between command
 * objects and the classes that wish to use them. Commands should be able to
 * execute when given the list of all tasks, to report whether their execution
 * caused a change in the list, and to return a reference to a list matching the
 * list as it was before the command's execution.
 * 
 * @author Patrick Dutch
 */
public interface Command {

	/**
	 * This method executes a command
	 * 
	 * @param tasks The list of all tasks managed by the program
	 * @throws GeekyDooException If an unrecoverable error occurs during command
	 *             execution
	 */
	public void execute(List<TaskType> tasks) throws GeekyDooException;

	/**
	 * This method returns whether or not a command modified the task list upon
	 * which it acted
	 * 
	 * @return true if the task list was modified, false otherwise
	 */
	public boolean isListModified();

	/**
	 * This method returns the task list which existed before this command was
	 * executed
	 * 
	 * @return A copy of the task list before command execution
	 */
	public List<TaskType> getPreExecutionList();

}
